from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel


class CreateDeliveryPersonRequest(BaseModel):
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    name: str
    phone: str


class UpdateDeliveryPersonRequest(BaseModel):
    id: int
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    name: str
    phone: str


class DeliveryPersonModel(BaseModel):
    id: int
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    status: Optional[int] = 1
    name: str
    phone: str
    delivering: Optional[int] = 0
    delivery_count: Optional[int] = 0

    class Config:
        from_attributes = True


class DeliveryPersonPagination(BaseModel):
    page: int
    page_size: int
    total: int
    data: List[DeliveryPersonModel]
